<%@ page language="java" import="java.util.*,com.opensymphony.xwork2.ActionContext,java.util.*" pageEncoding="UTF-8"%>

<%
String actiontype=(String)ActionContext.getContext().getValueStack().findValue("actiontype");
String actionname="'"+(String)ActionContext.getContext().getValueStack().findValue("actionname")+"'";
int currentpage=(Integer)ActionContext.getContext().getValueStack().findValue("currentpage");
int pageresult=(Integer)ActionContext.getContext().getValueStack().findValue("pageresult");
int pagecount=(Integer)ActionContext.getContext().getValueStack().findValue("pagecount");
int resultcount=(Integer)ActionContext.getContext().getValueStack().findValue("resultcount");
%>
<script type="text/javascript">
function qingkong()
{
	document.forms(0).actiontype.value="";
	document.forms(0).actionname.value="";
	document.forms(0).currentpage.value="";
	document.forms(0).pageresult.value="";
	document.forms(0).pagecount.value="";
	document.forms(0).resultcount.value="";
}

function pagehandle(action)
{
	//alert(<%=actionname%>);
	var actionname=<%=actionname%>;
	//alert("action的值为:"+action+";actionname的值为："+actionname);
	if(action==1)//首页
	{
		document.forms(0).currentpage.value=1;
	}
	if(action==2)//上页
	{
		if(document.forms(0).currentpage.value>1)
		{
			document.forms(0).currentpage.value=document.forms(0).currentpage.value-1;
		}
	}
	if(action==3)//下页
	{
		if(document.forms(0).currentpage.value<document.forms(0).pagecount.value)
		{
			document.forms(0).currentpage.value=parseInt(document.forms(0).currentpage.value)+1;
		}
	}
	if(action==4)//末页
	{
		document.forms(0).currentpage.value=document.forms(0).pagecount.value;
	}
	if(action==5)//每页
	{
		document.forms(0).currentpage.value=1;
		document.forms(0).pageresult.value=document.getElementById("pageresultselect").value;
	}
	if(action==6)//转到
	{
		document.forms(0).currentpage.value=document.getElementById("currentpageselect").value;
	}
	document.forms(0).action=actionname+".action";
	document.forms(0).submit();
}

</script>
<br>
   <span onclick="javascript:pagehandle(1)" onmouseover="this.style.cursor='hand'">首页</span>
   <span onclick="javascript:pagehandle(2)" onmouseover="this.style.cursor='hand'">上页</span> 
   <span onclick="javascript:pagehandle(3)" onmouseover="this.style.cursor='hand'">下页</span>
   <span onclick="javascript:pagehandle(4)" onmouseover="this.style.cursor='hand'">末页</span>  
   共${resultcount }条记录 
   每页
   <select name="pageresultselect" id="pageresultselect" onchange="javascript:pagehandle(5)">
   	<option value="1">1</option>
   	<option value="10">10</option>
   	<option value="20">20</option>
   	<option value="50">50</option>
   	<option value="100">100</option>
  </select>
  	<script type="text/javascript">
		document.getElementById("pageresultselect").value=document.forms(0).pageresult.value;
	</script>
   条
   分
 ${pagecount }
   页显示 
   转到 
   <select name="currentpageselect" id="currentpageselect" onchange="javascript:pagehandle(6)">
	  <s:bean name="org.apache.struts2.util.Counter" id="counter">
	   <s:param name="first" value="1" />
	   <s:param name="last" value="pagecount" />
	   <s:iterator>
	     <option value="${current-1}"><s:property/></option>
	   </s:iterator>
	</s:bean>
  </select>
  	<script type="text/javascript">
		document.getElementById("currentpageselect").value=document.forms(0).currentpage.value;
	</script>
   页